Link Wrap
In order to use client-side routing in nextjs, we need to pass a custom Link
element. If provided, this component wraps links with the custom element properly and enables full client-side navigation. If not, it's transparent entirely and renders a normal link.
Use this tag as you would normally use an a
tag, but with the additional Link
prop. It will pass through all children and props and behave exactly as if you were using a normal a
tag.
Example usage:
import Link from 'next/link'
export default () => {
return (
<LinkWrap Link={Link} href="/foo/bar" className="my-classname">
My link text etc
</LinkWrap>
)
}
Props
Link
- [optional] nextjs link component